package com.system.address.controller;

import com.system.address.domain.Address;
import org.springframework.web.bind.annotation.*;

/**
 * @author Lisiyu
 * date 2022/10/19 19:48
 * version 1.0
 */
@RestController
@RequestMapping("/address")
public class AddressController {

    @GetMapping("/info/{id}")
    public Address findById(@PathVariable Integer id){
        Address address = new Address();
        address.setId(id);
        address.setName("changzhi"+id);
        return address;
    }

    @GetMapping("/nameid")
    public Address getByIdAndName(Integer id, String name) {
        Address address = new Address();
        address.setId(id);
        address.setName(name);
        return address;
    }

    @PostMapping("/add")
    public int addAddress(@RequestBody Address address) {
        System.err.println(address);
        return 1;
    }
}
